//获取博客列表
function getBlogList(keyword){
    return new Promise(function(resolve,reject){
        $.get(`http://localhost:3000?keyword=`+keyword,(data)=>{
            resolve(data);
        })
    })
}i

//根据id指定博客
function getBlogByid(id){
    return new Promise(function(resolve,reject){
        $.get(`http://localhost:3000/Blog/${id}`,(data)=>{
            resolve(data);
        })
    })
}

//新增博客
function addBlog(obj){
    return new Promise(function(resolve,reject){
        $.post(`http://localhost:3000/Blog`,obj,(data)=>{
            resolve(data);
        })
    })
}
//更新博客
function updateBlog(id,obj){
    return new Promise(function(resolve,reject){
      $.ajax({
          url:`http://localhost:3000/Blog/${id}`,
          type:"PUT",
          success:function(data){
              resolve(data)
          }
      })
    })
}

//删除博客
function deleteBlog(id){
    return new Promise(function(resolve,reject){
       $.ajax({
           url:`http://localhost:3000/Blog/${id}`,
           type:"Delete",
           success:function(data){
               resolve(data)
           }
       })
    })
}
//查询博客
function getProductList(id){
    return new Promise(function(resolve,reject){
        $.ajax({
            url:`http://localhost:3000/Blog/${id}`,
            type:"PUT",
            success:function(data){
                resolve(data)
            }
        })
    })
}